
package com.eyedog.video.videolist;

import com.eyedog.video.entity.AdvVideoEntity;
import com.eyedog.video.http.ICallback;

import java.util.List;

public class VideoPresenter implements constract.IPresenter {

    constract.IModel model;

    constract.IView view;

    public VideoPresenter(constract.IModel model, constract.IView view) {
        this.model = model;
        this.view = view;
    }

    @Override
    public void showVideoList(int pageId, int category) {
        this.model.loadVideoList(pageId, category, new ICallback<List<AdvVideoEntity>>() {
            @Override
            public void onLoadSuccess(List<AdvVideoEntity> advVideoEntities) {
                view.showVideoList(advVideoEntities);
            }

            @Override
            public void onLoadFailed(String err) {
            }
        });
    }

    @Override
    public void showVideoList(int pageId, String keyWords) {
        this.model.loadVideoList(pageId, keyWords, new ICallback<List<AdvVideoEntity>>() {
            @Override
            public void onLoadSuccess(List<AdvVideoEntity> advVideoEntities) {
                view.showVideoList(advVideoEntities);
            }

            @Override
            public void onLoadFailed(String err) {

            }
        });
    }

    @Override
    public void showRecommendVideoList(int pageId) {
        this.model.loadRecommendVideoList(pageId, new ICallback<List<AdvVideoEntity>>() {
            @Override
            public void onLoadSuccess(List<AdvVideoEntity> advVideoEntities) {
                view.showVideoList(advVideoEntities);
            }

            @Override
            public void onLoadFailed(String err) {

            }
        });
    }

    @Override
    public void showNewestVideoList(int pageId) {
        this.model.loadNewestVideoList(pageId, new ICallback<List<AdvVideoEntity>>() {
            @Override
            public void onLoadSuccess(List<AdvVideoEntity> advVideoEntities) {
                view.showVideoList(advVideoEntities);
            }

            @Override
            public void onLoadFailed(String err) {

            }
        });
    }

}
